<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <ui:composition template="Template.xhtml">
        <ui:define name="top">
            消息中心

        </ui:define>
        <ui:define name="content">

            <h:form id="form">
                <p:panel>

                    <p:dataTable var="item" value="#{messageMB.items}" paginator="true" rows="10"
                                 paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
                                 rowsPerPageTemplate="5,10,15"   id="Table" lazy="true">


                        <p:column headerText="发送#{bundle.date}" sortBy="#{item.createtime}" >
                            <h:outputText value="#{item.createtime}" >
                                <f:convertDateTime pattern="YYYY/MM/dd HH:mm"  />
                            </h:outputText>
                        </p:column>
                        <p:column headerText="发送人" sortBy="#{item.createuserid.name}" filterBy="#{item.createuserid.name}">
                            <h:outputText value="#{item.createuserid.name}" >

                            </h:outputText>
                        </p:column>
                        <p:column headerText="接收人/角色" >
                            <h:outputText value="#{item.recrole.roleName}" rendered="#{item.recrole.roleName!=null}" >

                            </h:outputText>
                            <h:outputText value="#{item.recuserid.name}" rendered="#{item.recrole.roleName==null&amp;&amp;item.recuserid.name!=null}" >

                            </h:outputText>
                        </p:column>
                        
                        <p:column headerText="内容" style="width: 30%;text-align: center;"  filterBy="#{item.msg}">
                            <h:outputText value="#{item.msg}" >

                            </h:outputText>
                        </p:column>
                        <p:column headerText="状态" sortBy="#{item.status}" style="width: 10%;text-align: center;">
                            <h:outputText value="#{item.status}"  converter="#{msgStateConvert}" />
                        </p:column>
                        <p:column style="width: 15%;text-align: center;">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.operation}"/>
                                <!--<shiro:hasPermission name="user:C">--> 
                                <p:button value="发送消息"  outcome="create"  style="margin-left: 15px" icon="ui-icon-plus">
                                </p:button>
                                <!--</shiro:hasPermission>-->
                            </f:facet>

                            <p:button value="#{bundle.view}"   >
                                <f:param name="idproblem" value=" " />
                            </p:button>

                            <!--<shiro:hasPermission name="user:D">--> 

                            <!--</shiro:hasPermission>-->
                        </p:column>
                    </p:dataTable>
                    <p:blockUI block="Table" trigger="Table">
                        LOADING<br />
                        <p:graphicImage name="img/ajaxloadingbar.gif"/>
                    </p:blockUI>
                </p:panel>
                <p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
                    <p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
                    <p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
                </p:confirmDialog>
            </h:form>
 
        </ui:define>
    </ui:composition>
</html>

